Refactor window handling, improve theme support, and update dependencies#1807
Refactor window handling, improve theme support, and update dependencies#1807ItsEeleeya wants to merge 153 commits into
Conversation
The header height now matches that of windows with Toolbars on macOS 26
…ier + fix onboarding decorations
The header height now matches that of windows with Toolbars on macOS 26
…ier + fix onboarding decorations
…a/Cap into next-base-improvements
…lugin_window_state's deny list
| ) | ||
| } | ||
|
|
||
| pub fn appears_transparent(&self) -> bool { |
There was a problem hiding this comment.
Minor clarity: this helper is used to decide shadow behavior, and it’s not necessarily a 1:1 mapping with .transparent(true) (e.g. Main). A short doc comment would help prevent future confusion.
| pub fn appears_transparent(&self) -> bool { | |
| /// Used to decide whether to disable the native window shadow (not a 1:1 mapping with `.transparent(true)`). | |
| pub fn appears_transparent(&self) -> bool { |
| self.run_on_main_thread({ | ||
| let webview = self.clone(); | ||
| move || { | ||
| let Ok(ns_window) = webview.ns_window() else { |
There was a problem hiding this comment.
with_nswindow_on_main() always returns Ok(()) even when the callback never runs (e.g. ns_window() not ready / no MainThreadMarker). That makes it hard for callers to reason about failure vs success. Might be worth returning a boolean / result back to the caller via a oneshot, or renaming to try_* to make the best-effort semantics explicit.
Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
| .find(|(path, _)| path == project_path) | ||
| .map(|(_, id)| *id) | ||
| .unwrap_or_else(|| { | ||
| panic!("editor window id should be registered before calling CapWindow::id ({project_path:?})") |
There was a problem hiding this comment.
Tiny thing: this panic! will crash the app if an Editor window ever hits CapWindow::id before registration (race / unexpected call order). If this is strictly a debug-time invariant, maybe debug_assert! + a logged fallback (or returning Option/Result from id) would be safer for release builds.
| return; | ||
| }; | ||
| // SAFETY: Tauri runs this on the main thread | ||
| let mtm = unsafe { MainThreadMarker::new_unchecked() }; |
There was a problem hiding this comment.
Since this closure is already run via run_on_main_thread, could we avoid new_unchecked() here and use the safe constructor?
| let mtm = unsafe { MainThreadMarker::new_unchecked() }; | |
| let mtm = MainThreadMarker::new().expect("Running on main thread"); |
…electOverlay and related code
| ctx.font = "16px system-ui"; | ||
| ctx.fillText("😀", 0, 24); | ||
| } catch {} | ||
| } catch { } |
There was a problem hiding this comment.
Minor formatting nit: catch { } looks like it’ll fight Prettier/linting (usually catch {}).
| } catch { } | |
| } catch {} |
| @@ -4996,7 +4841,6 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) { | |||
| hotkeys::OnEscapePress, | |||
| upload::UploadProgressEvent, | |||
| import::VideoImportProgress, | |||
There was a problem hiding this comment.
Since SetCaptureAreaPending is removed from the exported events here, can you also regenerate/update the generated bindings in apps/desktop/src/utils/tauri.ts? It still declares SetCaptureAreaPending and maps setCaptureAreaPending: "set-capture-area-pending", which will be stale / potentially break listeners at runtime.
Refactor window handling, improve theme support, and modernize native integration
Overview
This PR refactors a few things with small improvements as a base for upcoming PRs. The changes modernize how windows are revealed, streamline macOS integration with native AppKit APIs, and better theme handling.
Key Changes
Window Management Refactoring
AutoRevealWindowOnReady: Automatically shows windows once content is loadedRevealWindowWithSuspense: Defers visibility for windows like Settings until routing and child mounting completesShowCapWindow→CapWindowthroughout the codebaseAppDelegateas Tauri now supports custom traffic lights insetdata-tauri-drag-region="deep"attribute (eliminates scattered manual markers)onMouseDown={showCropOptionsMenu}in Editor crop section withonClickas keyboard/touch fallbackTheme/Appearance Improvements
AppTheme→Appearance(with serde fallback for backward compatibility)Code Organization
src-tauri/src/display_utils.rsout ofwindows.rsMonitorExtandCursorMonitorInfotypes organizedpanel_manager.rs: Now macOS-only with streamlined logicmenu.rsmoduleNative Platform Integration
objc2ecosystem crates (app-kit, foundation, permissions)objc2-app-kitversionWebviewWindowExttrait withwith_nswindow_on_main()utility for direct AppKit window accesstauri_plugin_window_statedenylist)UI/UX Enhancements
scale-50class)⌘+,shortcutDependencies & Plugins
tauri-plugin-prevent-default: Enables default context menu only during developmentTechnical Notes
objc2crates instead of legacy objc/cocoaSuggested changelog entires:
⌘+,shortcut.Greptile Summary
This PR refactors desktop window handling and native integration. The main changes are:
ShowCapWindowtoCapWindowacross Rust and generated bindings.themetoappearancewith persisted-store compatibility.Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
appearancewhile accepting the old persisted key.Reviews (3): Last reviewed commit: "Merge branch 'main' into pr/1807" | Re-trigger Greptile
Context used: